# Dialog configuration

Configuration of existing plugins:
  - select the dialog layer provider in /opt/voicebot/settings/phxvbot.yml, field nlp/vendor
  - example configurations:
    a) Simple repetition of your question
         nlp:
           vendor: "repeater/RepeaterNlpProvider"
         repeater:
           language: cz

    b) IBM Watson Assistant
         nlp:
           vendor: "watson/WatsonNlpProvider"
         watson:
           assistant_id: "1b3a8231-..."
           assistant_iam_apikey: "E-OmvEC..."
           assistant_iam_url: "https://gateway-lon.watsonplatform.net/assistant/api"
           api_version: "2020-04-01".

    c) BornDigital GoodBot
         nlp:
           vendor: goodbot/GoodBotNlpProvider
         goodbot:
           url:  "https://server.com/"
           flow: "flow_id"
  - test your dialog without telephony/STT and TTS
      /opt/voicebot/testnlp
  - restart the voicebot
      /opt/voicebot/restart

Writing your plugin or a dialog script
  - go to /opt/voicebot/lib/nlp
  - copy the 'repeater' directory to your own one under /opt/voicebot/lib/nlp, for example, mydialog
  - rename the RepeaterNlpProvider.js file, for example, to MyDialogNlpProvider.js
  - modify the JavascriptFile, the module has the following interface:

      export interface NlpProviderBase extends EventEmitter {
        // returns your module name
        getName() : string;
        // send text to the dialog layer and get answer
        // - Call - identifies one channel/call
        // - message - text sent to the dialog layer, "" for the first call
        sendMessage(call: Call, message: string): Promise<string>;
        // releases the resources when the call is ended
        onCallStoped(callId: CallId): Promise<void>;
      }

  - change the configuration file /opt/voicebot/settings/phxvbot.yml
       nlp:
         vendor: "mydialog/MyDialogNlpProvider"

  - test your dialog without telephony/STT and TTS
      /opt/voicebot/testnlp
  - restart the voicebot
      /opt/voicebot/restart
 
